package com.wcm.system.utils;

import com.wcm.system.code.SystemCode;
import com.wcm.web.result.Result;
import com.wcm.web.result.ResultEnum;

public class resultUtil {
    public static Result success(Object object){
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESSFUL.getCode());
        result.setMsg(ResultEnum.SUCCESSFUL.getMsg());
        result.setData(object);
        return result;
    }

    public static Result fail(){
        Result result = new Result();
        result.setCode(ResultEnum.FAIL.getCode());
        result.setMsg(ResultEnum.FAIL.getMsg());
        return result;
    }
    public static Result unknownError(){
        Result result = new Result();
        result.setCode(ResultEnum.UNKNOW_ERROR.getCode());
        result.setMsg(ResultEnum.UNKNOW_ERROR.getMsg());
        return result;
    }

    public static Result unknownPluginMethodeError(){
        Result result = new Result();
        result.setCode(SystemCode.NOT_FOUND_PLUGIN_METHOD_ERROR.getCode());
        result.setMsg(SystemCode.NOT_FOUND_PLUGIN_METHOD_ERROR.getMsg());
        return result;
    }

    public static Result unknownPluginError(){
        Result result = new Result();
        result.setCode(SystemCode.NOT_FOUND_PLUGIN_ERROR.getCode());
        result.setMsg(SystemCode.NOT_FOUND_PLUGIN_ERROR.getMsg());
        return result;
    }
}
